<!--
 * @Description: 
 * @version: 
 * @Author: 尹鹏孝
 * @Date: 2022-03-07 14:38:07
 * @LastEditors: 尹鹏孝
 * @LastEditTime: 2022-03-07 16:42:16
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>字符串反转</title>
</head>
<body>
    <script>
      var reverseString = function (s) {
            for(let i=0,j=s.length/2;i<j;i++,j--){
                let tmp=s[j];
                s[j]=s[i];
                s[j]=tmp;
            }
           
            return s;
        };
      let res= reverseString('123456');
      console.log(res);
    </script>
    
</body>
</html>
